﻿#include "socket.h"
#include <iostream>
int main()
{
    Socket socket;
    socket.createTcpClient(58888, "127.0.0.1");
    std::string msg = "hello, server";
    socket.send(msg.c_str(), msg.size());
    char buf[1024];
    ssize_t ret = socket.recv(buf, sizeof(buf));
    if(ret < 0)
    {
        std::cout << "server disconnected, client_fd: " << socket.fd() << std::endl;
    }
    buf[ret] = '\0';
    std::cout << "recv: " << buf << std::endl;
    socket.close();
    return 0;
}